<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<html>
<base href="<%=basePath%>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="js/toastr.js"></script>
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="css/toastr.css" rel="stylesheet" type="text/css">
<link href="css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="css/base.css" rel="stylesheet" type="text/css">
<link href="css/reg.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="css/headbott.css" type="text/css" />
<link rel="stylesheet" href="css/ace.min.css" type="text/css" />
</head>
<body>
	<div id="header">
		<div class="heade-con">
			<div class="logo">
				<a href=""><img src="images/LOGO.png" /></a>
			</div>
			<div class="nav posa">
				<ul>
					<li><a href="index.do">首页</a></li>
					<li><a href="project/queryByType.do">公益众筹</a></li>
					<li><a href="problem/queryAll.do">常见问题</a></li>
					<li><a href="ly-list.do">众筹资讯</a></li>
					<li><a href="new_info.do" style="">发布项目</a></li>
				</ul>
			</div>
			<div class="search">
				<form action="">
					<input type="text" class="search-txt" value="找项目"> <input
						type="submit" class="search-but" value="">
				</form>
			</div>
			<div class="index-login">

				<c:choose>
					<c:when test="${login_user!=null }">
						<a href="project/queryByUsId.do">${login_user.usAccount }</a>
						<a href = "user/quit.do">退出</a>
					</c:when>
					<c:otherwise>
						<a href="login.do">登录</a>
						<span style="color: white;">|</span>
						<a class="vcolor" href="reg.do">注册</a>
					</c:otherwise>
				</c:choose>


			</div>
		</div>
	</div>
	<div class="login-container">

		<div class="space-6"></div>

		<div class="position-relative">
			<div id="signup-box" class="signup-box widget-box no-border">
				<div class="widget-body">
					<div class="widget-main">
						<h4 class="header green lighter bigger">
							<i class="ace-icon fa fa-users blue"></i> 用户注册
						</h4>

						<div class="space-6"></div>
						<p>填写信息:</p>

						<form>
							<fieldset>
								<label class="block clearfix"> <span
									class="block input-icon input-icon-left"> <input
										id="u_phone" type="text" class="form-control"
										placeholder="邮箱或手机号码" /> <i class="ace-icon fa fa-envelope"></i>
								</span>
								</label> <label class="block clearfix"> <span
									class="block input-icon input-icon-left"> <input
										id="u_account" type="text" class="form-control"
										placeholder="用户名" /> <i class="ace-icon fa fa-user"></i>
								</span>
								</label> <label class="block clearfix"> <span
									class="block input-icon input-icon-left"> <input
										id="u_pass1" type="password" class="form-control"
										placeholder="密码" /> <i class="ace-icon fa fa-lock"></i>
								</span>
								</label> <label class="block clearfix"> <span
									class="block input-icon input-icon-left"> <input
										id="u_pass2" type="password" class="form-control"
										placeholder="确认密码" /> <i class="ace-icon fa fa-retweet"></i>
								</span>
								</label>
								<!--验证码-->
								<label class="block clearfix"> <span> <input
										type="text" id= "send_code" class="" placeholder="验证码" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											
									<button class="btn btn-default" type="button" id="hsbtn" >点击获取验证码</button>
									
								</span>
								</label> <label class="block"> <input type="checkbox"
									name="u_check" class="ace" /> <span class="lbl"> 接受 <a
										href="#">用户协议</a>
								</span>
								</label>

								<div class="space-24"></div>

								<div class="clearfix">
									<button type="reset" class="width-30 pull-left btn btn-sm">
										<i class="ace-icon fa fa-refresh"></i> <span
											class="bigger-110">重置</span>
									</button>

									<button type="button" id="zhuce_btn"
										class="width-65 pull-right btn btn-sm btn-success">
										<span class="bigger-110">注册</span> <i
											class="ace-icon fa fa-arrow-right icon-on-right"></i>
									</button>
								</div>
							</fieldset>
						</form>
						<!--第三方-->
						<div class="social-or-login center">
							<span class="bigger-110">第三方登录</span>
						</div>

						<div class="space-6"></div>

						<div class="social-login center">
							<a href="#"> <img src="images/weixin.png">
							</a> <a href="#"> <img src="images/qq.png">
							</a> <a href="#"> <img src="images/sina.png">
							</a>
						</div>
					</div>

					<div class="toolbar center">
						<a href="login.html" data-target="#login-box"
							class="back-to-login-link"> <i
							class="ace-icon fa fa-arrow-left"></i> 返回登录
						</a>
					</div>
				</div>
				<!-- /.widget-body -->
			</div>
		</div>
	</div>
	<div id="bottom">
		<div class="bottom-ggt">
			<a href=""><img src="images/bottbom_68.jpg" alt="" /></a>
		</div>
		<div class="zc-yqlink">
			<ul>
				<li><a href="">阿里巴巴集团</a></li>
				<li><a href="">淘宝网</a></li>
				<li><a href="">天猫</a></li>
				<li><a href="">聚划算</a></li>
				<li><a href="">全球速卖通</a></li>
				<li><a href="">阿里巴巴国际交易市场</a></li>
				<li><a href="">1688</a></li>
				<li><a href="">阿里妈妈</a></li>
				<li><a href="">阿里旅行</a></li>
				<li><a href="">阿里云计算</a></li>
				<li><a href="">阿里巴巴集团</a></li>
				<li><a href="">淘宝网</a></li>
				<li><a href="">天猫</a></li>
				<li><a href="">聚划算</a></li>
				<li><a href="">全球速卖通</a></li>
				<li><a href="">阿里巴巴国际交易市场</a></li>
				<li><a href="">1688</a></li>
				<li><a href="">阿里妈妈</a></li>
				<li><a href="">阿里云计算</a></li>
			</ul>
		</div>
		<div class="footer-bd">

			<a href=" ">关于淘宝</a> <a href=" ">合作伙伴</a> <a href=" ">营销中心</a> <a
				href=" ">廉正举报</a> <a href=" ">联系客服</a> <a href=" ">开放平台</a> <a
				href=" ">诚征英才</a> <a href=" ">联系我们</a> <a href=" ">网站地图</a> <a
				href=" ">法律声明</a> <em>© 2003-2015 Taobao.com 版权所有</em><br> <br>
			<span>网络文化经营许可证：<a href=" ">浙网文[2013]0268-027号</a></span> <b>|</b> <span
				data-spm-protocol="i">增值电信业务经营许可证：<a href="">浙B2-20080224-1</a></span>
			<b>|</b> <span>信息网络传播视听节目许可证：1109364号</span> <b>|</b> <span>举报电话:0571-81683755</span>
		</div>
	</div>

</body>
<script type="text/javascript">
	$("#zhuce_btn")
			.click(
					function() {
						var u_phone = $("#u_phone").val();
						var u_account = $("#u_account").val();
						var u_pass1 = $("#u_pass1").val();
						var u_pass2 = $("#u_pass2").val();
						var send_code = $("#send_code").val();

						var reg_phone = /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/;
						var reg_account = /^[a-zA-Z0-9\u4E00-\u9FA5]{2,6}$/;
						var reg_pass = /^(?![A-Z]+$)(?![a-z]+$)(?!\d+$)\S{8,}$/;

						var u_check = document.getElementsByName("u_check")[0];

						if (!reg_phone.test(u_phone)) {
							toastr.error("电话号码格式不对");
						} else if (!reg_account.test(u_account)) {
							toastr.error("账号不对必须是2-6为");
						} else if (!reg_pass.test(u_pass1)) {
							toastr.error("密码格式错误");
						} else if (u_pass1 != u_pass2) {
							toastr.error("两次密码不一致");
						} else if (!u_check.checked) {
							toastr.error("请接收协议")
						} else {
							$.ajax({
								url : "user/addUser.do",
								type : "post",
								data : {
									"usPhone" : u_phone,
									"usAccount" : u_account,
									"usPassword" : u_pass1,
									"send_code":send_code
								},
								success : function(data) {
									if (data == 1) {
										toastr.info("注册成功");
										setTimeout(
												"window.location.href='login.do'",
												1000)
									} else if (data == 3) {
										toastr.info("注册失败该账户名已存在")
									}else if (data == 8){
										toastr.error("验证码错误");
									} else {
										toastr.info("注册失败")
									}
									
								},
								error : function() {
									toastr.error("服务端错误");
								}
							})
						}

					})
</script>
<script>
        function djs () {
            var util = {
                wait: 90,
                hsTime: function (that) {
                    _this = $(this);
                    if (_this.wait == 0) {
                        $('#hsbtn').removeAttr("disabled").val('重发短信验证码');
                        _this.wait = 90;
                    } else {
                        var _this = this;
                        $(that).attr("disabled", true).val('在' + _this.wait + '秒后点此重发');
                        _this.wait--;
                        setTimeout(function () {
                            _this.hsTime(that);
                        }, 1000)
                    }
                }
            }
            util.hsTime('#hsbtn');
            $("#hsbtn").click(function(){
                util.hsTime('#hsbtn');
            })
        }
        
        
        $("#hsbtn").click(function(){
        	
        	var u_phone = $("#u_phone").val();
        	$.ajax({
        		url:"user/send_code.do",
        		type:"post",
        		data:{"phone":u_phone},
        		success:function(){
        			alert("aaa")
        			djs ();
        		}
        	})
        	
        })
        
        
        
        
    </script>
</html>